<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        canvas {
            border: 1px solid #ccc;
        }
    </style>
</head>
<body>
<canvas width="600" height="400"></canvas>
<script>
    var myCanvas = document.querySelector('canvas');
    var ctx = myCanvas.getContext('2d');
    /*绘制点*/
    /*1.点的尺寸*/
    /*2.点的坐标中心*/

    //点的坐标
    var coordinate = {
        x: 100,
        y: 100
    }
    var dottedSize = 6;

    ctx.moveTo(coordinate.x - dottedSize / 2, coordinate.y - dottedSize / 2);
    ctx.lineTo(coordinate.x + dottedSize / 2, coordinate.y - dottedSize / 2);
    ctx.lineTo(coordinate.x + dottedSize / 2, coordinate.y + dottedSize / 2);
    ctx.lineTo(coordinate.x - dottedSize / 2, coordinate.y + dottedSize / 2);
    ctx.closePath();
    ctx.fill();
</script>
</body>
</html>
